/*
 * main.js
 * 天气分析主页
 */
;
(function (call) {
    var main = {
        baseUrl: CafeJS.CXT,
        mapId: "tjMap",
        toolsBar: null,
        userInfo: null,
        importantCGLayer:"importantCGLayer",
        areaExent: {
            12: [114.94, 38.32, 119.80, 40.47], // 全市
            120110: [117.23, 39.25, 117.56, 39.01], // 东丽区
            120111: [116.87, 39.17, 117.34, 38.83], // 西青区
            120112: [117.22, 39.08, 117.54, 38.84], // 津南区
            120113: [116.95, 39.35, 117.40, 39.18], // 北辰区
            120114: [116.79, 39.70, 117.34, 39.15], // 武清区
            120115: [117.14, 39.83, 117.69, 39.38], // 宝坻区
            120116: [117.15, 39.29, 118.03, 38.57], // 滨海新区
            120221: [117.31, 39.60, 117.94, 39.18], // 宁河区
            120223: [116.70, 39.08, 117.24, 38.62], // 静海区
            120125: [117.14, 40.25, 117.78, 39.78], // 蓟州区
            hhly: [108.71, 43.88, 123.66, 35.55], // 海河流域
            china: [135, 55, 80, 15], // 中国
        },
        router: {
            autostatTemplate: '/business/template/autostat.html',
			stnfTemplate: '/business/template/stnf.html',
            industryShareTemplate:'/business/template/industryshare.html',
            elePicTemplate: '/business/template/elePicTemplate.html',
            GPSWaterTemplate: '/business/template/GPSWater.html',
            physicalTemplate: '/business/template/physical.html',
            surfacehighTemplate: '/business/template/surfacehigh.html',
            szybTemplate: '/business/template/szyb.html',
            sateTemplate: '/business/template/sate.html',
            radarTemplate: '/business/template/radar.html',
            lightTemplate: '/business/template/light.html',
            airplaneTemplate: '/business/template/airplane.html',
            pqpfTemplate: '/business/template/pqpf.html',
            strongcfTemplate: '/business/template/strongcf.html',
            dweatherTemplate: '/business/template/dweather.html',
			cma3kmlagTemplate: '/business/template/cma3kmlag.html',
			CMAREPShhlyTemplate: '/business/template/CMAREPShhly.html',
            zqjdjsTemplate: '/business/template/zqjdjs.html',
            shortrainTemplate: '/business/template/shortrain.html',
            jsxtybTemplate: '/business/template/jsxtyb.html',
            lbdfcpTemplate: '/business/template/lbdfcp.html',
            dsqjscpTemplate:'/business/template/dsqjscp.html',
            jsTemplate: '/business/template/js.html',
            wdTemplate: '/business/template/wd.html',
            dwTemplate: '/business/template/dw.html',
            rhTemplate: '/business/template/rh.html',
            snowDepTemplate: '/business/template/snowDep.html',
            gustTemplate: '/business/template/gust.html',
            nwgdskTemplate: '/business/template/nwgdsk.html',
            zbsfTemplate: '/business/template/zbsf.html',
            nwgdybTemplate: '/business/template/nwgdyb.html',
            nwgdybglTemplate: '/business/template/nwgdybgl.html',
            mosybTemplate: '/business/template/mosyb.html',
            gdybTemplate: '/business/template/gdyb.html',
            gridView: "/business/template/grid-details.html",
            userInfo: '/fwzz/userInfo',
            skpmTemplate: '/business/template/sk-ranking.html',
            getLatestTime: 'zhfx/station/skTime',
            dateAnalysisTemplate: '/business/template/dateAnalysis.html',
			stnfDateAnalysisTemplate:'/business/template/stnfdateAnalysis.html',
            eleConfigTemplate: '/business/template/eleConfig.html',
            indexAllocationTemplate: '/business/template/indexAllocation.html',
            wlltjyzIndexAllocationTemplate: '/business/template/wlltjyzIndexAllocation.html',
			dmsybTemplate:'/business/template/dmsyb.html' //多模式集成降水预报
        },
        init: function () {
            this.initView();
            this.bindEvt();
        },
        initView: function () {
            this.initToolsBar();
            this.bindClickMap();
            this.showGridPop();
            this.getLatestTime();
        },
        getUserInfo: function () {
            var that = this;
            var userId = this.queryParam('userId') || '10003';
            $("#userInfo").data('isMatchuser',userId == "00002"?true:false);
            $.ajax({
                url: that.router.userInfo,
                async: false,
                dateType: 'json',
                data: { userId: userId }
            }).done(function (res) {
                if (!res.isSuccess) return;
                that.userInfo = res.data;
                $("#userInfo").data('info', res.data);
            }).fail(function () {
                that.userInfo = {
                    userAreaCode: 12
                }
            })
        },
        // 获取自动站最新实况时间
        getLatestTime: function () {
            var that = this;
            $.ajax({
                url: this.router.getLatestTime,
                type: 'GET',
                dataType: 'json',
                async: false
            }).done(function (res) {
                if (res.isSuccess)
                    $("#latestTime").val(res.data);
            })
        },
        queryParam: function (val) {
            var uri = window.location.search;
            var re = new RegExp("" + val + "=([^&?]*)", "ig");
            return ((uri.match(re)) ? (uri.match(re)[0].substr(val.length + 1)) : null);
        },
        showGridPop: function () {
            GIS.GridShow.showGridData(this.mapId, function (d) {
                if (d.length > 0) {
                    var $tip = $('<div>');
                    var $ul = $('<ul>').css({ 'margin-bottom': 0 });
                    $.each(d, function () {
                        var layerId = this.id;
                        var val = this.val;
                        if (parseInt(val) != val)
                            val = Number(val).toFixed(1);
                        $('.cafe-layer-item').each(function () {
                            var proInfo = $(this).data('proInfo');
                            var eleId = proInfo.ele.ele_id;
                            var bussitype = proInfo.bussitype;
                            var unit = proInfo.ele.unit || '';
                            if (proInfo.isGrid && layerId.indexOf(bussitype) != -1 && layerId.lastIndexOf(eleId) != -1) {
                                if(typeof $(this).data("numData2") != 'undefined'){
                                    var numData2 = $(this).data("numData2");
                                    var numData = $(this).data("numData");
                                    numData2.every(function(num,index){
                                        if(num === val){
                                            val = numData[index];
                                            return false;
                                        }else{
                                            return true;
                                        }
                                    })
                                }
                                $ul.append(`<li>${proInfo.name + ': ' + val + unit}</li>`);
                                return false;
                            }
                        })
                    });
                    return $tip.append($ul);
                }
                return false;
            }, {
                    "color": "#fff",
                    "text-shadow": "0 0 1px #000",
                    "background-color": "rgba(0,0,0,0.5)",
                    "padding": "3px 6px",
                    "white-space": "nowrap",
                    "text-align": "left",
                    "font-size": "12px",
                    "font-weight": "500",
                    "border-radius": "2px"
                }, { id: "analysis-griddata-tip", iconUrl: "business/common/css/images/aim.png" })
        },
        // 任意点详情
        bindClickMap: function () {
            var that = this;
            GIS.MouseEvent.showLatLon(that.mapId, function (location) {
                $("#lat").text(location.lat);
                $("#lon").text(location.lon);
            }, null, null);
        },
        importantCG:function(id,selected){
            var that = this;
            let layerId = that.importantCGLayer;
            if(GLMap.layerIds.indexOf(layerId) != -1){
                GIS.LayerControll.deleteLayer(that.mapId, [layerId]);
            }
            if(!selected){
                return;
            }
            //{lon:117.21,lat:39.14,name:'解放桥'},
            /**let stationData = [{lon:117.220656,lat:39.046226,name:'梅江会展中心'},{lon:117.724743,lat:38.981272,name:'天津港智慧码头'},
                                {lon:117.384661,lat:39.120895,name:'空客总装厂'},{lon:117.209818,lat:39.086100,name:'天津大剧院'},
                                {lon:117.146630,lat:39.105184,name:'天开园'},{lon:117.1772,lat:39.1571,name:'海河码头'},
                                {lon:117.186378,lat:39.142387,name:'古文化街'}];*/
            let stationData = [{lon:117.340687,lat:38.946152,name:'碧桂园'}]
            var option = {
                "iconUrl": '/business/szyb/css/images/triangle.png',
                "key": "location",
                "xOffset": 0,
                "yOffset": 0,
                "id": layerId,
                "data": [],
                "iconObj": {
                    "icon": {"x": 0, "y": 0 }
                }
            }
            stationData.map(item=>{
               option.data.push({
                   "lon": item.lon,
                    "lat": item.lat,
                    "location": "icon",
                    "data":item
               }) 
            })
            GIS.Station.showIcons_canvas(this.mapId, option);
            GIS.MouseEvent.Bind(that.mapId, layerId, null, function(data, id, e){
                return `<div class="hoverPop"><span>${data.data.name}</span></div>`;
            }, null, null, null);
        },
        //初始化工具条
        initToolsBar: function () {
            var _this = this;
			debugger
            _this.toolsBar = CafeJS.CFToolsbar({
                appendTo: '.cafe-busis-container',
                gisId: _this.mapId,
                barList: _this.barCfg(),
                call: function (id, selected, index) {
                    $("#loadIframe").attr("src", "").parent().hide();
                    $(".load-iframe").removeClass("load-special");
                    
                    if(['tjcx','hysk','hjsk','qhjc'].indexOf(id)!=-1){
                        $("#importantCG").hide();
                        let layerId = _this.importantCGLayer;
                        if(GLMap.layerIds.indexOf(layerId) != -1){
                            GIS.LayerControll.deleteLayer(_this.mapId, [layerId]);
                        } 
                    }else if(['szyb','importantCG','zhsk','kgyb'].indexOf(id)!=-1){
                        $("#importantCG").show();
                    }
					
                    if (id != 'zhsk') $('.sk-ranking').remove();
                    switch (id) {
                        case 'zhsk':
                        case 'szyb':
                        case 'kgyb':
                            _this.initChildMenu(_this.barCfg().menubar[index].child);
                            $("#childMenu").show();
                            _this.showHideToolsbar(false);
                            break;
                        case 'tjcx':
                        case 'hysk':
                        case 'hjsk':
                        case 'qhjc':
                            $("#loadIframe").attr("src", _this.barCfg().menubar[index].targetUrl + _this.userInfo.smuser.iid).parent().show();
                            _this.showHideToolsbar(true);
                            break;
                        case "eleConfig":
                            _this.eleConifg(id, selected);
                            break;
                        case "importantCG":
                            _this.importantCG(id,selected);
                            break;
                        case "elePic":
                            _this.initElePic(id, selected);
                            break;
                    }
					if(['szyb','zhsk','kgyb'].indexOf(id)!=-1){
						debugger
						setTimeout(()=>{
							_this.toolsBar.activeBtn(['importantCG'],false);
							_this.importantCG('importantCG',true);
						},500)
						
					}
                }
            });
            _this.toolsBar.trigger('zhsk');
			
        },
        initElePic: function (id, selected) {
            var that = this;
            if (CafeJS.ModalBoxExist(id)) {
                if (!selected) {
                    CafeJS.ModalBoxHide(id);
                    $(".icon-elepic").removeClass("active");
                } else {
                    CafeJS.ModalBoxShow(id);
                    $(".icon-elepic").addClass("active");
                }
                return;
            }
            $(".icon-elepic").addClass("active");
            CafeJS.ModalBox({
                id: id,
                container: 'cafe-busis-container',
                title: "要素出图",
                width: 880,
                m_top: 90,
                m_right: (window.innerWidth - 850)/2,
                hide: true,
                url: that.router.elePicTemplate,
                closed: function () {
                    $(".icon-elepic").addClass("active");
                }
            });
        },
        //显隐右边工具栏
        showHideToolsbar: function (isHide) {
            if (isHide)
                $(".cafe-busis-toolsbar-right").hide();
            else
                $(".cafe-busis-toolsbar-right").show();
        },
        //要素配置
        eleConifg: function (id, isSelectd) {
            var that = this;
            if (!isSelectd) {
                CafeJS.ModalBoxHide(id);
                return;
            }
            if (CafeJS.ModalBoxExist(id)) {
                CafeJS.ModalBoxClose(id);
            }
            CafeJS.ModalBox({
                id: id,
                container: 'cafe-busis-container',
                title: "要素配置",
                width: 580,
                m_top: 90,
                m_right: 100,
                hide: true,
                url: that.router.eleConfigTemplate,
                closed: function () {
                    $("#eleConfig").removeClass("active");
                    CafeJS.ModalBoxClose(id);
                }
            });
        },
        //指数配置
        exponentCfg: function (id, isSelectd) {
            var that = this;
            if (!isSelectd) {
                CafeJS.ModalBoxHide(id);
                return;
            }
            if (CafeJS.ModalBoxExist(id)) {
                CafeJS.ModalBoxClose(id);
            }
            CafeJS.ModalBox({
                id: id,
                container: 'cafe-busis-container',
                title: "指数配置",
                width: 1740,
                height: 300,
                m_top: 140,
                m_right: 110,
                hide: false,
                url: "wlltjyz_index_allocation" == id ? that.router.wlltjyzIndexAllocationTemplate:that.router.indexAllocationTemplate,
                closed: function () {
                    $(".index-allocation").removeClass("active");
                    CafeJS.ModalBoxClose(id);
                }
            });
        },
        //时序分析
        showDateAnalysis: function (id) {
            var that = this;
            if (CafeJS.ModalBoxExist(id)) {
                CafeJS.ModalBoxClose(id);
            }
            CafeJS.ModalBox({
                id: id,
                container: 'cafe-busis-container',
                title: "时序分析",
                width: 1600,
                height: 700,
                m_top: 90,
                m_right: 100,
                hide: true,
                url: that.router.dateAnalysisTemplate,
                closed: function () {
                }
            });
        },
		//STNF时序分析
        showStnfDateAnalysis: function (id) {
            var that = this;
            if (CafeJS.ModalBoxExist(id)) {
                CafeJS.ModalBoxClose(id);
            }
            CafeJS.ModalBox({
                id: id,
                container: 'cafe-busis-container',
                title: "时序分析",
                width: 1600,
                height: 700,
                m_top: 90,
                m_right: 100,
                hide: true,
                url: that.router.stnfDateAnalysisTemplate,
                closed: function () {
                }
            });
        },
        // 站点标识控制
        statSignControl: function (selected, sign, layerIshow) {
            var layerIds = [];
            var stationTypes = CafeJS.tqfx.toolsBar.getStationType().split(',');
            stationTypes.forEach(function (type) {
                var id = "WIND" + type + sign;
                GLMap.layerIds.forEach(function (layerId) {
                    if (layerId == id)
                        layerIds.push(layerId);
                })
            })
            if (layerIshow != undefined) {
                if (layerIshow)
                    GIS.LayerControll.showControll(CafeJS.tqfx.mapId, layerIds, selected);
                else
                    GIS.LayerControll.showControll(CafeJS.tqfx.mapId, layerIds, layerIshow);
            } else {
                GIS.LayerControll.showControll(CafeJS.tqfx.mapId, layerIds, selected);
            }
        },
        // 自动站
        initAutoStat: function (id, selected) {
            var that = this;
            $("#datepicker-autostat").show();
            $(".cafe-busis-squarelegend").show();
            if (CafeJS.ModalBoxExist(id)) {
                if (!selected) {
                    CafeJS.ModalBoxHide(id);
                    $("#datepicker-autostat").hide();
                    $("#childMenu div").removeClass("active");
                } else {
                    $("#childMenu ." + id).addClass("active");
                    CafeJS.ModalBoxShow(id);
                }
                return;
            }
            CafeJS.ModalBox({
                id: id,
                container: 'cafe-busis-container',
                title: "自动站",
                width: 395,
                m_top: 90,
                m_left: 150,
                hide: true,
                url: that.router.autostatTemplate,
                closed: function () {
                    $("#datepicker-"+ id).hide();
                    $("#childMenu ." + id).removeClass("active");
                }
            });
        },
        //行业共享
        initIndustryShare:function(id, selected){
            var that = this;
            $("#datepicker-industryShare").show();
            $(".cafe-busis-squarelegend").show();
            if (CafeJS.ModalBoxExist(id)) {
                if (!selected) {
                    CafeJS.ModalBoxHide(id);
                    $("#datepicker-industryShare").hide();
                } else {
                    CafeJS.ModalBoxShow(id);
                }
                return;
            }
            CafeJS.ModalBox({
                id: id,
                container: 'cafe-busis-container',
                title: "行业共享",
                width: 400,
                height: 460,
                m_top: 90,
                m_left: 150,
                hide: true,
                url: that.router.industryShareTemplate,
                closed: function () {
                    $("#datepicker-"+ id).hide();
                    $("#childMenu ." + id).removeClass("active");
                }
            });
        },
        // GPS水汽
        initGPSWater: function (id, selected) {
            var that = this;
            $("#datepicker-GPSWater").show();
            $(".cafe-busis-squarelegend").show();
            if (CafeJS.ModalBoxExist(id)) {
                if (!selected) {
                    CafeJS.ModalBoxHide(id);
                    $("#datepicker-GPSWater").hide();
                } else {
                    CafeJS.ModalBoxShow(id);
                }
                return;
            }
            CafeJS.ModalBox({
                id: id,
                container: 'cafe-busis-container',
                title: "GPS水汽",
                width: 325,
                height: 150,
                m_top: 90,
                m_left: 150,
                hide: true,
                url: that.router.GPSWaterTemplate,
                closed: function () {
                    $("#datepicker-"+ id).hide();
                    $("#childMenu ." + id).removeClass("active");
                }
            });
        },
        // 实况监测排名
        initSKPM: function () {
            var that = this;
            if ($('.autostat').hasClass('active')) {
                var $div = $('<div>').addClass('sk-ranking');
                $(".cafe-busis-container").append($div);
                if ($('.cafe-busis-container .sk-ranking').length < 2) {
                    $(".sk-ranking").show();
                } else {
                    $(".sk-ranking").remove();
                }
                $(".sk-ranking").empty().load(that.router.skpmTemplate, function () {
                    $(".ranking-head").draggable({
                        container: '.sk-ranking',
                    });
                })
            } else {
                $(".sk-ranking").remove();
            }
        },
        // 物理量
        initPhysical: function (id, selected) {
            var that = this;
            $("#datepicker-physical").show();
            if (CafeJS.ModalBoxExist(id)) {
                if (!selected) {
                    CafeJS.ModalBoxHide(id);
                    $("#datepicker-physical").hide();
                } else {
                    CafeJS.ModalBoxShow(id);
                }
                return;
            }
            CafeJS.ModalBox({
                id: id,
                container: 'cafe-busis-container',
                title: "物理量",
                width: 325,
                m_top: 90,
                m_left: 150,
                hide: true,
                url: that.router.physicalTemplate,
                closed: function () {
                    $("#datepicker-"+ id).hide();
                    $("#childMenu ." + id).removeClass("active");
                }
            });
        },
        // 形势场
        initSurfacehigh: function (id, selected) {
            var that = this;
            $("#datepicker-surfacehigh").show();
            
            $('.cafe-layer-item').each(function(){
                var proInfo = $(this).data('proInfo');
                if (proInfo.bussitype == 'autostat') {
                    if (!$(this).find('.layer-eye').hasClass('disabled')) {
                        $(this).find('.layer-eye').click();
                    }
                }
            })
            if (CafeJS.ModalBoxExist(id)) {
                if (!selected) {
                    CafeJS.ModalBoxHide(id);
                    $("#datepicker-surfacehigh").hide();
                } else {
                    CafeJS.ModalBoxShow(id);
                }
                return;
            }
            CafeJS.ModalBox({
                id: id,
                container: 'cafe-busis-container',
                title: "天气形势",
                width: 325,
                m_top: 90,
                m_left: 150,
                hide: true,
                url: that.router.surfacehighTemplate,
                closed: function () {
                    $("#datepicker-"+ id).hide();
                    $("#childMenu ." + id).removeClass("active");
                }
            });
        },
        //卫星
        initSate: function (id, selected) {
            var that = this;
            $("#datepicker-sate").show();
            if (CafeJS.ModalBoxExist(id)) {
                if (!selected) {
                    CafeJS.ModalBoxHide(id);
                    $("#datepicker-sate").hide();
                } else {
                    CafeJS.ModalBoxShow(id);
                }
                return;
            }
            CafeJS.ModalBox({
                id: id,
                container: 'cafe-busis-container',
                title: "卫星",
                width: 365,
                m_top: 90,
                m_left: 150,
                hide: true,
                url: that.router.sateTemplate,
                closed: function () {
                    $("#datepicker-"+ id).hide();
                    $("#childMenu ." + id).removeClass("active");
                }
            });
        },
        // 雷达
        initRadar: function (id, selected) {
            var that = this;
            $("#datepicker-dlcp").show();
            if (CafeJS.ModalBoxExist(id)) {
                if (!selected) {
                    CafeJS.ModalBoxHide(id);
                    $("#datepicker-dlcp").hide();
                } else {
                    CafeJS.ModalBoxShow(id);
                }
                return;
            }
            CafeJS.ModalBox({
                id: id,
                container: 'cafe-busis-container',
                title: "雷达",
                width: 325,
                m_top: 90,
                m_left: 150,
                hide: true,
                url: that.router.radarTemplate,
                closed: function () {
                    $("#datepicker-"+ id).hide();
                    $("#childMenu ." + id).removeClass("active");
                }
            });
        },
        //闪电
        initLight: function (id, selected) {
            var that = this;
            $("#datepicker-light").show();
            if (CafeJS.ModalBoxExist(id)) {
                if (!selected) {
                    CafeJS.ModalBoxHide(id);
                    $("#datepicker-light").hide();
                } else {
                    CafeJS.ModalBoxShow(id);
                }
                return;
            }
            CafeJS.ModalBox({
                id: id,
                container: 'cafe-busis-container',
                title: "闪电",
                width: 390,
                height: 220,
                m_top: 90,
                m_left: 20,
                hide: true,
                url: that.router.lightTemplate,
                closed: function () {
                    $("#datepicker-"+ id).hide();
                    $("#childMenu ." + id).removeClass("active");
                }
            });
        },
        // 数值预报
        initSZYB: function (id, selected) {
            var _this = this;
            $(".cafe-busis-squarelegend").hide();
            if (CafeJS.ModalBoxExist(id)) {
                if (!selected) {
                    CafeJS.ModalBoxHide(id);
                } else {
                    CafeJS.ModalBoxShow(id);
                    $(".cafe-busis-playlist").show();
                }
                return;
            }
            CafeJS.ModalBox({
                id: id,
                container: 'cafe-busis-container',
                title: "数值预报",
                width: 420,
                height: 700,
                m_top: 55,
                m_left: 150,
                hide: true,
                url: _this.router.szybTemplate,
                closed: function () {
                    $("#childMenu ." + id).removeClass("active");
                }
            });

        },
        // 概率预报
        initPQPF: function (id, selected) {
            var _this = this;
            $(".cafe-busis-squarelegend").hide();
            if (CafeJS.ModalBoxExist(id)) {
                if (!selected) {
                    CafeJS.ModalBoxHide(id);
                } else {
                    CafeJS.ModalBoxShow(id);
                    $(".cafe-busis-playlist").show();
                }
                return;
            }
            CafeJS.ModalBox({
                id: id,
                container: 'cafe-busis-container',
                title: "概率预报",
                width: 330,
                m_top: 55,
                m_left: 150,
                hide: true,
                url: _this.router.pqpfTemplate,
                closed: function () {
                    $("#childMenu ." + id).removeClass("active");
                }
            });

        },
        //强对流预报
        initStrongcf: function (id, selected, type, name) {
            var _this = this;
            $(".cafe-busis-squarelegend").hide();
            if (CafeJS.ModalBoxExist(id)) {
                if (!selected) {
                    CafeJS.ModalBoxHide(id);
                    $('.index-allocation').hide();
                } else {
                    $('#'+type).click();
                    $('#modal_'+id).find('.modal-title').html(name+'<div></div>');
                    
                    CafeJS.ModalBoxShow(id);
                    $(".cafe-busis-playlist").show();
                    $('.index-allocation').show();

                }
                return;
            }
            $('.index-allocation').show();
            _this.loadInterval = null;
            CafeJS.ModalBox({
                id: id,
                container: 'cafe-busis-container',
                title: name,
                width: 360,
                m_top: 55,
                m_left: 150,
                hide: true,
                url: _this.router.strongcfTemplate,
                loadSuccess: function() {
                    _this.loadInterval = setInterval(function() {
                        if ($('#'+type).length > 0) {
                            clearInterval(_this.loadInterval);
                            $('#'+type).click();
                        }
                    }, 300)
                },
                closed: function () {
                    $('#childMenu li.active').removeClass("active");
                }
            });

        },
		initcma3kmlag: function (id, selected) {
            var _this = this;
            $(".cafe-busis-squarelegend").hide();
            if (CafeJS.ModalBoxExist(id)) {
                if (!selected) {
                    CafeJS.ModalBoxHide(id);
                } else {
                    CafeJS.ModalBoxShow(id);
                    $(".cafe-busis-playlist").show();
                }
                return;
            }
            CafeJS.ModalBox({
                id: id,
                container: 'cafe-busis-container',
                title: "CMA3km-LAG",
                width: 420,
                m_top: 55,
                m_left: 150,
                hide: true,
                url: _this.router.cma3kmlagTemplate,
                closed: function () {
                    $("#childMenu ." + id).removeClass("active");
                }
            });

        },
		initCMAREPShhly: function (id, selected) {
            var _this = this;
            $(".cafe-busis-squarelegend").hide();
            if (CafeJS.ModalBoxExist(id)) {
                if (!selected) {
                    CafeJS.ModalBoxHide(id);
                } else {
                    CafeJS.ModalBoxShow(id);
                    $(".cafe-busis-playlist").show();
                }
                return;
            }
            CafeJS.ModalBox({
                id: id,
                container: 'cafe-busis-container',
                title: "CMA-REPS-hhly",
                width: 420,
                m_top: 55,
                m_left: 150,
                hide: true,
                url: _this.router.CMAREPShhlyTemplate,
                closed: function () {
                    $("#childMenu ." + id).removeClass("active");
                }
            });

        },
        //扰动天气图
        initDweather: function (id, selected) {
            var _this = this;
            $(".cafe-busis-squarelegend").hide();
            if (CafeJS.ModalBoxExist(id)) {
                if (!selected) {
                    CafeJS.ModalBoxHide(id);
                } else {
                    CafeJS.ModalBoxShow(id);
                    $(".cafe-busis-playlist").show();
                }
                return;
            }
            CafeJS.ModalBox({
                id: id,
                container: 'cafe-busis-container',
                title: "扰动天气图",
                width: 420,
                m_top: 55,
                m_left: 150,
                hide: true,
                url: _this.router.dweatherTemplate,
                closed: function () {
                    $("#childMenu ." + id).removeClass("active");
                }
            });

        },
        // 中期极端降水
        initZqjdjs: function (id, selected) {
            var _this = this;
            $(".cafe-busis-squarelegend").hide();
            if (CafeJS.ModalBoxExist(id)) {
                if (!selected) {
                    CafeJS.ModalBoxHide(id);
                } else {
                    CafeJS.ModalBoxShow(id);
                    $(".cafe-busis-playlist").show();
                }
                return;
            }
            CafeJS.ModalBox({
                id: id,
                container: 'cafe-busis-container',
                title: "中期极端降水",
                width: 420,
                m_top: 55,
                m_left: 150,
                hide: true,
                url: _this.router.zqjdjsTemplate,
                closed: function () {
                    $("#childMenu ." + id).removeClass("active");
                }
            });

        },
        //短时降水产品
        initShortRain: function (id, selected) {
            var _this = this;
            if (CafeJS.ModalBoxExist(id)) {
                if (!selected) {
                    CafeJS.ModalBoxHide(id);
                } else {
                    CafeJS.ModalBoxShow(id);
                    $(".cafe-busis-playlist").show();
                }
                return;
            }
            CafeJS.ModalBox({
                id: id,
                container: 'cafe-busis-container',
                title: "短时降水",
                width: 360,
                height: 200,
                m_top: 55,
                m_left: 150,
                hide: true,
                url: _this.router.shortrainTemplate,
                closed: function () {
                    $("#childMenu ." + id).removeClass("active");
                }
            });
        },
        //降水相态预报
        initJsxtyb: function (id, selected) {
            var _this = this;
            if (CafeJS.ModalBoxExist(id)) {
                if (!selected) {
                    CafeJS.ModalBoxHide(id);
                } else {
                    CafeJS.ModalBoxShow(id);
                    $(".cafe-busis-playlist").show();
                }
                return;
            }
            CafeJS.ModalBox({
                id: id,
                container: 'cafe-busis-container',
                title: "降水相态预报",
                width: 380,
                height: 230,
                m_top: 55,
                m_left: 150,
                hide: true,
                url: _this.router.jsxtybTemplate,
                closed: function () {
                    $("#childMenu ." + id).removeClass("active");
                }
            });
        },
        //雷暴大风产品
        initLbdfcp: function (id, selected) {
            var _this = this;
            if (CafeJS.ModalBoxExist(id)) {
                if (!selected) {
                    CafeJS.ModalBoxHide(id);
                } else {
                    CafeJS.ModalBoxShow(id);
                    $(".cafe-busis-playlist").show();
                }
                return;
            }
            CafeJS.ModalBox({
                id: id,
                container: 'cafe-busis-container',
                title: "雷暴大风产品",
                width: 360,
                height: 200,
                m_top: 55,
                m_left: 150,
                hide: true,
                url: _this.router.lbdfcpTemplate,
                closed: function () {
                    $("#childMenu ." + id).removeClass("active");
                }
            });
        },
        //短时强降水产品
        initDsqjscp: function (id, selected) {
            var _this = this;
            if (CafeJS.ModalBoxExist(id)) {
                if (!selected) {
                    CafeJS.ModalBoxHide(id);
                } else {
                    CafeJS.ModalBoxShow(id);
                    $(".cafe-busis-playlist").show();
                }
                return;
            }
            CafeJS.ModalBox({
                id: id,
                container: 'cafe-busis-container',
                title: "短时强降水产品",
                width: 360,
                height: 250,
                m_top: 55,
                m_left: 150,
                hide: true,
                url: _this.router.dsqjscpTemplate,
                closed: function () {
                    $("#childMenu ." + id).removeClass("active");
                }
            });
        },
        //降水
        initJs: function (id, selected) {
            var _this = this;
            if (CafeJS.ModalBoxExist(id)) {
                if (!selected) {
                    CafeJS.ModalBoxHide(id);
                } else {
                    CafeJS.ModalBoxShow(id);
                    $(".cafe-busis-playlist").show();
                }
                return;
            }
            CafeJS.ModalBox({
                id: id,
                container: 'cafe-busis-container',
                title: "降水",
                width: 360,
                height: 260,
                m_top: 55,
                m_left: 150,
                hide: true,
                url: _this.router.jsTemplate,
                closed: function () {
                    $("#childMenu ." + id).removeClass("active");
                }
            });
        },
        //温度
        initWd: function (id, selected) {
            var _this = this;
            if (CafeJS.ModalBoxExist(id)) {
                if (!selected) {
                    CafeJS.ModalBoxHide(id);
                } else {
                    CafeJS.ModalBoxShow(id);
                    $(".cafe-busis-playlist").show();
                }
                return;
            }
            CafeJS.ModalBox({
                id: id,
                container: 'cafe-busis-container',
                title: "温度",
                width: 360,
                height: 340,
                m_top: 55,
                m_left: 150,
                hide: true,
                url: _this.router.wdTemplate,
                closed: function () {
                    $("#childMenu ." + id).removeClass("active");
                }
            });
        },
        //大雾
        initDw: function (id, selected) {
            var _this = this;
            if (CafeJS.ModalBoxExist(id)) {
                if (!selected) {
                    CafeJS.ModalBoxHide(id);
                } else {
                    CafeJS.ModalBoxShow(id);
                    $(".cafe-busis-playlist").show();
                }
                return;
            }
            CafeJS.ModalBox({
                id: id,
                container: 'cafe-busis-container',
                title: "大雾",
                width: 360,
                height: 200,
                m_top: 55,
                m_left: 150,
                hide: true,
                url: _this.router.dwTemplate,
                closed: function () {
                    $("#childMenu ." + id).removeClass("active");
                }
            });
        },
        //湿度
        initRh:function(id, selected){
            var _this = this;
            if (CafeJS.ModalBoxExist(id)) {
                if (!selected) {
                    CafeJS.ModalBoxHide(id);
                } else {
                    CafeJS.ModalBoxShow(id);
                    $(".cafe-busis-playlist").show();
                }
                return;
            }
            CafeJS.ModalBox({
                id: id,
                container: 'cafe-busis-container',
                title: "湿度",
                width: 360,
                height: 200,
                m_top: 55,
                m_left: 150,
                hide: true,
                url: _this.router.rhTemplate,
                closed: function () {
                    $("#childMenu ." + id).removeClass("active");
                }
            });
        },
        //雪深
        initSnowDep:function(id, selected){
            var _this = this;
            if (CafeJS.ModalBoxExist(id)) {
                if (!selected) {
                    CafeJS.ModalBoxHide(id);
                } else {
                    CafeJS.ModalBoxShow(id);
                    $(".cafe-busis-playlist").show();
                }
                return;
            }
            CafeJS.ModalBox({
                id: id,
                container: 'cafe-busis-container',
                title: "雪深",
                width: 360,
                height: 200,
                m_top: 55,
                m_left: 150,
                hide: true,
                url: _this.router.snowDepTemplate,
                closed: function () {
                    $("#childMenu ." + id).removeClass("active");
                }
            });
        },
        //阵风
        initGust:function(id, selected){
            var _this = this;
            if (CafeJS.ModalBoxExist(id)) {
                if (!selected) {
                    CafeJS.ModalBoxHide(id);
                } else {
                    CafeJS.ModalBoxShow(id);
                    $(".cafe-busis-playlist").show();
                }
                return;
            }
            CafeJS.ModalBox({
                id: id,
                container: 'cafe-busis-container',
                title: "阵风",
                width: 360,
                height: 200,
                m_top: 55,
                m_left: 150,
                hide: true,
                url: _this.router.gustTemplate,
                closed: function () {
                    $("#childMenu ." + id).removeClass("active");
                }
            });
        },
        //周边省份
        initZBSF:function(id, selected){
            var _this = this;
            if (CafeJS.ModalBoxExist(id)) {
                if (!selected) {
                    CafeJS.ModalBoxHide(id);
                } else {
                    CafeJS.ModalBoxShow(id);
                    $(".cafe-busis-playlist").show();
                }
                return;
            }
            CafeJS.ModalBox({
                id: id,
                container: 'cafe-busis-container',
                title: "周边省份",
                width: 360,
                height: 205,
                m_top: 55,
                m_left: 150,
                hide: true,
                url: _this.router.zbsfTemplate,
                closed: function () {
                    $("#childMenu ." + id).removeClass("active");
                }
            });
        },
		initSTNF:function(id, selected){
			var _this = this;
            if (CafeJS.ModalBoxExist(id)) {
                if (!selected) {
                    CafeJS.ModalBoxHide(id);
                } else {
                    CafeJS.ModalBoxShow(id);
                    $(".cafe-busis-playlist").show();
                }
                return;
            }
            CafeJS.ModalBox({
                id: id,
                container: 'cafe-busis-container',
                title: "STNF",
                width: 395,
                m_top: 90,
                m_left: 150,
                hide: true,
                url: _this.router.stnfTemplate,
                closed: function () {
                    $("#childMenu ." + id).removeClass("active");
                }
            });
		},
        //国家指导实况
        initNWGDSK: function (id, selected) {
            var _this = this;
            if (CafeJS.ModalBoxExist(id)) {
                if (!selected) {
                    CafeJS.ModalBoxHide(id);
                } else {
                    CafeJS.ModalBoxShow(id);
                    $(".cafe-busis-playlist").show();
                }
                return;
            }
            CafeJS.ModalBox({
                id: id,
                container: 'cafe-busis-container',
                title: "国家指导实况",
                width: 360,
                height: 205,
                m_top: 55,
                m_left: 150,
                hide: true,
                url: _this.router.nwgdskTemplate,
                closed: function () {
                    $("#childMenu ." + id).removeClass("active");
                }
            });
        },
        //国家指导预报
        initNWGDYB: function (id, selected) {
            var _this = this;
            if (CafeJS.ModalBoxExist(id)) {
                if (!selected) {
                    CafeJS.ModalBoxHide(id);
                } else {
                    CafeJS.ModalBoxShow(id);
                    $(".cafe-busis-playlist").show();
                }
                return;
            }
            CafeJS.ModalBox({
                id: id,
                container: 'cafe-busis-container',
                title: "国家指导预报",
                width: 360,
                height: 480,
                m_top: 55,
                m_left: 150,
                hide: true,
                url: _this.router.nwgdybTemplate,
                closed: function () {
                    $("#childMenu ." + id).removeClass("active");
                }
            });
        },
        //国家指导预报
        initNWGDYBGL: function (id, selected) {
            var _this = this;
            if (CafeJS.ModalBoxExist(id)) {
                if (!selected) {
                    CafeJS.ModalBoxHide(id);
                } else {
                    CafeJS.ModalBoxShow(id);
                    $(".cafe-busis-playlist").show();
                }
                return;
            }
            CafeJS.ModalBox({
                id: id,
                container: 'cafe-busis-container',
                title: "国家指导概率预报",
                width: 360,
                height: 240,
                m_top: 55,
                m_left: 150,
                hide: true,
                url: _this.router.nwgdybglTemplate,
                closed: function () {
                    $("#childMenu ." + id).removeClass("active");
                }
            });
        },
        //MOS预报
        initMOSYB: function (id, selected) {
            var _this = this;
            if (CafeJS.ModalBoxExist(id)) {
                if (!selected) {
                    CafeJS.ModalBoxHide(id);
                } else {
                    CafeJS.ModalBoxShow(id);
                    $(".cafe-busis-playlist").show();
                }
                return;
            }
            CafeJS.ModalBox({
                id: id,
                container: 'cafe-busis-container',
                title: "MOS温度预报",
                width: 360,
                m_top: 55,
                m_left: 150,
                hide: true,
                url: _this.router.mosybTemplate,
                closed: function () {
                    $("#childMenu ." + id).removeClass("active");
                }
            });
        },

        //飞机报
        initAirplane: function (id, selected) {
            var _this = this;
            $("#datepicker-airplane").show();
            if (CafeJS.ModalBoxExist(id)) {
                if (!selected) {
                    CafeJS.ModalBoxHide(id);
                    $("#datepicker-airplane").hide();
                } else {
                    CafeJS.ModalBoxShow(id);
                    $(".cafe-busis-playlist").show();
                }
                return;
            }
            CafeJS.ModalBox({
                id: id,
                container: 'cafe-busis-container',
                title: "飞机报",
                display: "none",
                url: _this.router.airplaneTemplate,
                closed: function () {
                    $("#childMenu ." + id).removeClass("active");
                }
            });
        },
		
		//多模式集合降水
        initDMSYB: function (id, selected) {
            var _this = this;
            if (CafeJS.ModalBoxExist(id)) {
                if (!selected) {
                    CafeJS.ModalBoxHide(id);
                } else {
                    CafeJS.ModalBoxShow(id);
                    $(".cafe-busis-playlist").show();
                }
                return;
            }
            CafeJS.ModalBox({
                id: id,
                container: 'cafe-busis-container',
                title: "多模式集成降水预报",
                width: 360,
                m_top: 55,
                m_left: 150,
                hide: true,
                url: _this.router.dmsybTemplate,
                closed: function () {
                    $("#childMenu ." + id).removeClass("active");
                }
            });
        },

        //基于滚动偏差温度预报
        initGDYB: function (id, selected) {
            var _this = this;
            if (CafeJS.ModalBoxExist(id)) {
                if (!selected) {
                    CafeJS.ModalBoxHide(id);
                } else {
                    CafeJS.ModalBoxShow(id);
                    $(".cafe-busis-playlist").show();
                }
                return;
            }
            CafeJS.ModalBox({
                id: id,
                container: 'cafe-busis-container',
                title: "基于滚动偏差温度预报",
                width: 360,
                m_top: 55,
                m_left: 150,
                hide: true,
                url: _this.router.gdybTemplate,
                closed: function () {
                    $("#childMenu ." + id).removeClass("active");
                }
            });
        },
        //初始化子菜单
        initChildMenu: function (menuList) {
            var that = this;
            var $parentObj = $("#childMenu");
            $parentObj.html("");
            var selectIndex = 0, selectChildIndex = null, menu;
            for (let i = 0; i < menuList.length; i++) {
                menu = menuList[i];
                var $firstMenu = $("<div class='first-menu'></div>");

                $firstMenu.addClass(menu.id);
                $firstMenu.data('menu', menu);
                $parentObj.append($firstMenu);

                $firstMenu.html(`<div><i></i><span>${menu.name}</span></div>`);

                if (menu.child && menu.child.length > 0) {
                    var $ul = $('<ul></ul>');
                    menu.child.forEach(function(secondMenu) {
                        var $li = $(`<li class=${secondMenu.id}><i></i>${secondMenu.name}</li>`);
                        $li.data('menu', secondMenu);
                        $ul.append($li);

                        if (secondMenu.select) {
                            selectChildIndex = i;
                        }
                    })
                    $firstMenu.append($ul);
                }

                if (menu.select) {
                    selectIndex = i;
                }
            }
            $parentObj.find('.first-menu, li').click(function (e) {
                e.stopPropagation();
                var menu = $(this).data('menu');
                var flag = $(this).hasClass("active");
                if (flag) {
                    if (menu.child) {
                        $(this).find('ul').hide();
                    }
                    $(this).removeClass("active");
                } else {
                    $('#childMenu li.active').removeClass("active");
                    $(this).addClass("active").siblings().removeClass("active");
                    if (menu.child) {
                        $(this).addClass('isParent');
                    }
                }
               // szyb.isShowDataAnalysis = false;
                $(".isShowDataAnysis").removeClass('isShowDataAnysis');
                if (!$(this).hasClass('autostat')) {
                    $(".sk-ranking").remove()
                }

                var hiddenId = that.getAllChildId();
                if (hiddenId.indexOf(menu.id) != -1)
                    CafeJS.ModalBoxHides(hiddenId, function () {
                        $('.cafe-busis-datepicker').children().hide();
                    });

                GIS.LayerControll.showControll(that.mapId, ["dem", "seadem"], true);

                that.mapAreaSet(that.userInfo.userAreaCode || 12);

                $(".product-pic-tab li.active").click(); // 关闭模式产品图

                CafeJS.ModalBoxClose('dateAnalysis'); // 关闭时序分析
                if (menu.child && !flag) {
                    $(this).siblings().find('ul').hide();
                    $(this).find('ul').show();
                } else {
                    that.clickMenu(menu, !flag);
                }
            })
            $('#childMenu div.first-menu').eq(selectIndex).click();
            if (selectChildIndex != null) {
                $('#childMenu div.first-menu').eq(selectIndex).find('li').eq(selectChildIndex).click();
            }
        },
        clickMenu: function (child, selected) {
            var _this = this;

            var id = child.id;
			$(".cafe-busis-toolsbar").hide();
            if (child.targetUrl && child.targetUrl != "") {
                $("#loadIframe").attr("src", "").parent().hide();
                if (!$("#childMenu ." + id).hasClass("active")) {
                    $(".load-iframe").removeClass("load-special");
                    _this.showHideToolsbar(false);
                    $("#a-m-timeline").show();
                    $(".cafe-busis-latlon,.cafe-busis-map").show();
                } else {
                    $("#a-m-timeline").hide();
                    $(".cafe-busis-latlon,.cafe-busis-map").hide();
                    $(".load-iframe").addClass("load-special");
                    _this.showHideToolsbar(true);
                    $("#loadIframe").attr("src", child.targetUrl).parent().show();
                }
            } else {
                $("#a-m-timeline").show();
                $(".cafe-busis-latlon,.cafe-busis-map").show();
                $("#loadIframe").attr("src", "").parent().hide();
                $(".load-iframe").removeClass("load-special");
                $("#modal_index_allocation").remove();
                $('.index-allocation').removeClass('active').hide();
                _this.showHideToolsbar(false);
                switch (id) {
                    case 'autostat':
                        _this.hideSKOrYB(id);
                        _this.initAutoStat(id, selected);
                        _this.initSKPM();
                        break;
                    case 'GPSWater':
                        _this.initGPSWater(id, selected);
                        break;
                    case 'industryshare':
                        _this.initIndustryShare(id, selected);
                        break;
                    case 'physical':
                        _this.initPhysical(id, selected);
                        break;
                    case 'sate':
                        _this.mapAreaSet('china');
                        _this.initSate(id, selected);
                        break;
                    case 'surfacehigh':
                        _this.mapAreaSet('china');
                        GIS.LayerControll.showControll(this.mapId, ["dem", "seadem"], false);
                        _this.initSurfacehigh(id, selected);
                        break;
                    case 'dlcp':
                        _this.mapAreaSet('hhly');
                        _this.initRadar(id, selected);
                        break;
                    case 'szyb':
                        _this.hideSKOrYB(id);
                        _this.initSZYB(id, selected);
                        break;
                    case 'pqpf':
                        _this.mapAreaSet('12');
                        _this.initPQPF(id, selected);
                        break;
                    case 'qdlsb':
                    case 'plf':
					case 'wlltjyz':
                    case 'qhwt':
                    case 'glfwt':
					case 'hbwtcp':
                    case 'ndsj':
                        _this.mapAreaSet('hhly');
                        _this.initStrongcf("strongcf", selected, id, child.name);
                        break;
                    case 'dweather':
                        _this.initDweather(id, selected);
                        break;
					case 'cma3kmlag':
                        _this.initcma3kmlag(id, selected);
                        break;
					case 'CMAREPShhly':
                        _this.initCMAREPShhly(id, selected);
                        break;	
                    case 'zqjdjs':
                        _this.initZqjdjs(id, selected);
                        break;
                    case 'shortrain':
                        _this.hideSKOrYB("kgyb");
                        _this.initShortRain(id, selected);
                        break;
                    case 'jsxtyb':
                        _this.hideSKOrYB("kgyb");
                        _this.initJsxtyb(id, selected);
                        break;
                    case 'lbdfcp':
                        _this.hideSKOrYB("kgyb");
                        _this.initLbdfcp(id, selected);
                        break;
                    case 'dsqjscp':
                        _this.hideSKOrYB("kgyb");
                        _this.initDsqjscp(id, selected);
                        break;    
                    case 'js':
                        _this.hideSKOrYB("kgyb");
                        _this.initJs(id, selected);
                        break;
                    case 'wd':
                        _this.hideSKOrYB("kgyb");
                        _this.initWd(id, selected);
                        break;
                    case 'dw':
                        _this.hideSKOrYB("kgyb");
                        _this.initDw(id, selected);
                        break;
                    case 'rh':
                        _this.hideSKOrYB("kgyb");
                        _this.initRh(id, selected);
                        break;
                    case 'snowDep':
                         _this.hideSKOrYB("kgyb");
                        _this.initSnowDep(id, selected);
                        break;
                    case 'gust':
                         _this.hideSKOrYB("kgyb");
                        _this.initGust(id, selected);
                        break;
                    case 'nwgdsk':
                        _this.initNWGDSK(id, selected);
                        break;
                    case 'nwgdyb':
                        _this.initNWGDYB(id, selected);
                        break;
                    case 'nwgdybgl':
                        _this.mapAreaSet('12');
                        _this.initNWGDYBGL(id, selected);
                        break;
                    case 'zbsf':
                        _this.initZBSF(id, selected);
                        break;
					 case 'stnf':
                        _this.initSTNF(id, selected);
                        break;
                    case 'mosyb':
                        _this.initMOSYB(id, selected);
                        break;
                    case 'gdyb':
                        _this.initGDYB(id, selected);
                        break;
                    case 'light':
                        _this.initLight(id, selected);
                        break;
                    case 'airplane':
                        _this.initAirplane(id, selected);
                        break;
					case 'dmsyb':
                        _this.initDMSYB(id, selected);
                        break;
                }
            }

        },
        hideSKOrYB: function (id) {
            var that = this;
            if ($(".cafe-layer-common-operate .layer-mutex").hasClass("disabled"))
                return;
            $(".cafe-layer-body").find(".cafe-layer-item").each(function () {
                var eleInfo = $(this).data('proInfo');
                var type = eleInfo.bussitype;
                var parentId = that.checkChildId(type);
                if (id !== parentId) {
                    $(this).find('.layer-close').click();
                }
            })
        },
        checkChildId: function (childId) {
            var menu = this.barCfg().menubar;
            for (var i = 0; i < menu.length; i++) {
                var menubar = menu[i];
                if (menubar.child) {
                    for (var j = 0; j < menubar.child.length; j++) {
                        if (childId === menubar.child[j].id) {
                            return menubar.id;
                        }
                    }
                }
            }
            return null;
        },
        // 地图范围设置
        mapAreaSet: function (area) {
            GIS.Extent.Set(this.mapId, { xmin: this.areaExent[area][0], xmax: this.areaExent[area][2], ymax: this.areaExent[area][1], ymin: this.areaExent[area][3] });
        },
        // 显示隐藏图层
        hideShowLayer: function (layerIds, isShow) {
            GIS.LayerControll.showControll(this.mapId, layerIds, isShow);
        },
        barCfg: function () {
            var isHide = false;
            var isAdmin = this.userInfo.smuser.iid == 2 ?  true : false;
            return {
                menubar: [
                    {
                        id: 'zhsk', name: '', icon: "icon-menu", isHide: isHide, child: [
                            { id: 'light', name: '闪电', select: true },
                        ]
                    },
                ],
                toolsbar: [
                    { id: 'importantCG', name: '重点场馆', icon: "icon-eleconfig", isHide: false,isDef:true },
                    { id: 'eleConfig', name: '要素配置', icon: "icon-eleconfig", isHide: !isAdmin },
                    { id: 'elePic', name: '要素出图', icon: "icon-elepic", isHide: false },
                    { id: 'location', name: '区域切换', icon: "icon-location", isHide: false },
                    { id: 'station', name: '站点类型', icon: "icon-station", isHide: false },
                    { id: 'grid', name: '时序图', icon: "icon-grid", isHide: true },
                    { id: 'layer', name: '产品图层', icon: "icon-layer", isHide: true },
                    { id: 'gistools', name: 'GIS工具', icon: "icon-gistools", isHide: false }
                ]
            }
        },
        getAllChildId: function () {
            var menu = this.barCfg().menubar;
            var arr = [];
            for (var i = 0; i < menu.length; i++) {
                var menubar = menu[i];
                if (menubar.child) {
                    for (var j = 0; j < menubar.child.length; j++) {
                        arr.push(menubar.child[j].id);
                        if (menubar.child[j].child) {
                            menubar.child[j].child.forEach(function(item){
                                arr.push(item.id);
                            })
                        }
                    }
                }
            }
            return arr;
        },
        bindEvt: function () {
            var that = this;
            $(".index-allocation").click(function () {
                debugger
                var isFlag = false;
                $(this).toggleClass('active');
                if ($(this).hasClass('active')) {
                    isFlag = true;
                } else {
                    isFlag = false;
                }
                that.exponentCfg($("#childMenu li.active").hasClass("wlltjyz") ? 'wlltjyz_index_allocation':'index_allocation', isFlag);
            })
        }
    };
    main.getUserInfo();
    if (typeof call === 'function') {
        CafeJS.tqfx = main;
        call(main);
    }

})(function (main) {
    CafeJS.models(['cafeMap', 'moddialogNew', 'toolsbar', 'layermanage'], function () {
        GIS.Init.initMap(main.mapId, "tianjin", "tianjin_WGS84", function () {
            main.init();
            GIS.Graphic.drawBoundary(main.mapId,"tjMapborderLayer",'12',{'strokeStyle':'rgba(0,0,0,1)','lineWidth':3})
        }, main.areaExent[main.userInfo.userAreaCode || 12], 'main', { fileName: 'regionData.json' });
        window.alert = function (info) {
            $.dialogMaster({ "type": 'tip', "info": info });
        }
    });
});
